package com.xinlong.service.impl;

import com.xinlong.dao.OrdersDao;
import com.xinlong.dao.TravellerMapper;
import com.xinlong.service.StatisticsService;
import com.xinlong.utils.TypeConversionUtils;
import org.aspectj.lang.annotation.Around;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.List;

@Service
public class StatisticsServiceImpl implements StatisticsService {
    @Autowired
    private OrdersDao ordersDao;
    @Autowired
    private TravellerMapper travellerMapper;

    @Override
    public Map<String, Object> monthTurnover() {
        return TypeConversionUtils.ListConversionMap(ordersDao.month());
    }

    @Override
    public Map<String, Object> yearTurnover() {
        return TypeConversionUtils.ListConversionMap(ordersDao.year());
    }

    @Override
    public Map<String, Object> popular() {
        return TypeConversionUtils.ListConversionMap(ordersDao.popular());
    }

    @Override
    public List<Map<String, Object>> occupationStatistics() {
        return travellerMapper.occupation();
    }

    @Override
    public List<Map<String, Object>> ageStatistics() {
        return travellerMapper.age();
    }

    @Override
    public List<Map<String, Object>> sexStatistics() {
        return travellerMapper.sex();
    }
}
